package training.bms.business;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
@Table(
		name="BLO_BLOG", 
		uniqueConstraints=@UniqueConstraint(columnNames="BLO_NAME")
)
public class Blog {
	
	private Integer indentifier;
	private String name;
	private String description;
	private Date date;

	@Column(name="BLO_NAME")
	@NotNull
	@Size(min=1, max=100, message="Please specify the blog name (100 characters max).")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	@Size(max=200, message="Please specify the blog description (100 characters max).")
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	@Column(name="BLO_CREATION_DATE")
	@NotNull
	@Temporal(TemporalType.DATE)
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	
	@Id
	@Column(name="BLO_IDENTIFIER")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Integer getIndentifier() {
		return indentifier;
	}
	public void setIndentifier(Integer indentifier) {
		this.indentifier = indentifier;
	}
}
